/*
 *  $Id: MercilessPunishment.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Light.Spells {
    public class MercilessPunishment: TargetEnchantmentCard<Creature> {
        public MercilessPunishment(): base("001_l_s_merciless_punishment") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Light;
            Value = 100;
            Target = new CreatureTarget(GetTargetPhrase(), true, true, IsNotHoly);
            AddManaCost(ElementType.Light, 1);
            AddCondition(new DelegateCondition(GetConditionPhrase(), TestMeditation));
        }

        private static bool IsNotHoly(TargetRequest request, Creature cr) {
            return !cr.IsHoly;
        }
        private static bool TestMeditation(AbstractObject caster, Card card) {
            return caster.Owner.MeditationCount > 0;
        }

        protected override EnchantmentAffect CreateEnchantment() {
            return new MercilessPunishmentAffect();
        }

        private class MercilessPunishmentAffect: GraveyardEnchantmentAffect<MercilessPunishment> {
            public MercilessPunishmentAffect() {
                Add(new Affects.AntiFlag<Affects.Tireless>());
                Add(new Affects.AntiFlag<Affects.NonBlocked>());
                Add(new Affects.AntiFlag<Affects.Agility>());
                Add(new Affects.AntiFlag<Affects.Fast>());
                Add(new Affects.AntiFlag<Affects.Regeneration>());
                Add(new Affects.AntiFlag<Affects.Reincarnation>());
                Add(new Affects.AntiFlag<Affects.Flight>());
            }

            public override void Dispell() {
                Owner.AddAffect(new Affects.Death(1));
                base.Dispell();
            }
        }
    }
}
